/***************************************************************************
 创建者: 华磊
 开始时间: 2018.11.6
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file
 *  功能: amcl参数
 *
 *                                                                         *
 ***************************************************************************/

#ifndef AMCLCONFIG_H
#define AMCLCONFIG_H
#include <qstring.h>
#include "amcl/sensors/amcl_laser.h"
#include "amcl/sensors/amcl_odom.h"
#include "globalDefine.h"
#include "GeneralDefine.h"

struct RosXml
{
    QString name;
    QString value;
};

class AmclConfig
{
public:
    AmclConfig(QString configFileIn, QString positionConfigPathIn);

public:
    int readConfigFile(QString filePath, QString positionConfigPathIn);
    int writeAmclPara(struct AmclDebugPara paraIn);
    int writeConfigFile(double initialPose_x,double initialPose_y,double initialPose_r);
    int writeConfigFile(QString filePath,double initialPose_x,double initialPose_y,double initialPose_r);


public:
    amcl::laser_model_t laser_model_type;
    int isUpdatePartialEveryTime;
    int calculateTimesForLaser;
    int laser_max_beams;
    int min_particles;
    int max_particles;
    amcl::odom_model_t odom_model_type;
    double update_min_d;
    double update_min_a;
    double odom_alpha1;
    double odom_alpha2;
    double odom_alpha3;
    double odom_alpha4;
    double odom_alpha5;
    bool isUseRosLaserMsg;
    double initial_pose_x;
    double initial_pose_y;
    double initial_pose_a;
    double initial_cov_x;
    double initial_cov_y;
    double initial_cov_r;
    double goodMatchScore;
    double badMatchScore;
    double newOdom_alpha_badMatchScore;
    double recovery_alpha_slow;//长时间平均随机粒子添加。
    double recovery_alpha_fast;//快速平均随机粒子添加
    int resample_interval;
    int odomOffsetFilterCount;
    bool isCorrectByReflect;
    double qualifyReflectMinCertaintyScore;
    int correctFilterCount;
    double correctAllowMaxDistanceOffset;
    double correctAllowMaxAngleOffset;



private:
    int getValue(QString nameIn, const QVector<RosXml> &infoList, QString &valueOut);
private:
    QString configFile;
    QString positionConfigPath;


};

#endif // AMCLCONFIG_H
